package com.yanqu.road.server.timer;

import com.yanqu.road.server.gameplayer.module.cricket.timer.CricketGameTaskTimer;
import com.yanqu.road.server.manger.scenecard.task.SceneCardTask;
import com.yanqu.road.server.timer.chefduel.ChefDuel2TimerTask;
import com.yanqu.road.server.timer.chefduel.ChefDuelPhase1ReloadCrossTimerTask;
import com.yanqu.road.server.timer.chefduel.ChefDuelTimerTask;
import com.yanqu.road.server.timer.curio.CurioTask;
import com.yanqu.road.server.timer.iceServer.IceServerGiftSendRewardTask;
import com.yanqu.road.server.timer.kuang.KuangUploadAttributeTask;
import com.yanqu.road.server.timer.banquet.CrossBanquetAutoOpenTask;
import com.yanqu.road.server.timer.marriage.RelativesUserInfoUpdateTask;
import com.yanqu.road.server.timer.messageSubscribe.MessageSubscribeTask;
import com.yanqu.road.server.timer.newmonopolymarket.NewMonopolyMarketTask;
import com.yanqu.road.server.timer.patrons.PatronsUploadAbilityTask;
import com.yanqu.road.server.timer.peakseacraft.PeakSeacraftRoundCheckTask;
import com.yanqu.road.server.timer.peakstronghold.PeakStrongholdTakeDataTask;
import com.yanqu.road.server.timer.platform.PlatformDataCheckTask;
import com.yanqu.road.server.timer.rankunionwar.RankUnionWarTimerTask;
import com.yanqu.road.server.timer.expire.SyncPendingMapTimerTask;
import com.yanqu.road.server.timer.snow.ActivityMallDayBuyTask;
import com.yanqu.road.server.timer.twins.TwinsTimerTask;
import com.yanqu.road.server.timer.union.cross.CrossUnionMemberAbilityCheckTask;
import com.yanqu.road.server.timer.union.cross.CrossUnionMemberAbilitySyncTask;
import com.yanqu.road.server.timer.union.cross.UploadUnionRewardTask;
import com.yanqu.road.server.timer.unioncampwar.UnionCampWarTask;
import com.yanqu.road.server.timer.washe.WasheAutoSendZhanLingTask;
import com.yanqu.road.server.timer.washe.WasheTask;
import com.yanqu.road.server.timer.wingroom.chakra.CheckBeVisitNumRecoverTask;
import com.yanqu.road.task.CheckDeadLockTask;
import com.yanqu.road.task.DirectMemoryMonitorTask;
import com.yanqu.road.server.TempServer;
import com.yanqu.road.server.timer.activity.*;
import com.yanqu.road.server.timer.beautyescort.BeautyEscortTask;
import com.yanqu.road.server.timer.bulletscreen.BulletScreenTask;
import com.yanqu.road.server.timer.client.msg.ClientPushMsgTask;
import com.yanqu.road.server.timer.cookboy.CookBoyTimerTask;
import com.yanqu.road.server.timer.cross3.ActivityAbleCheckTask;
import com.yanqu.road.server.timer.cross3.GameXRankAllSyncTask;
import com.yanqu.road.server.timer.dataanalytics.DataAnalyticsTask;
import com.yanqu.road.server.timer.disperseGold.DisperseGoldTask;
import com.yanqu.road.server.timer.estatewar.EstateWarCheckDailyRewardTask;
import com.yanqu.road.server.timer.fb.GetFbFollowCountTask;
import com.yanqu.road.server.timer.grouprank.UploadGroupRankTask;
import com.yanqu.road.server.timer.hunt.HuntResetTask;
import com.yanqu.road.server.timer.mammon.CrossMammonSyncTask;
import com.yanqu.road.server.timer.manor.CheckManorHelpRecoverTask;
import com.yanqu.road.server.timer.marriage.CheckApplyOverTimeTask;
import com.yanqu.road.server.timer.minewar.CheckMinePitOverTimeTask;
import com.yanqu.road.server.timer.monopolymarket.MonopolyMarketJoinUnionTask;
import com.yanqu.road.server.timer.monopolymarket.MonopolyMarketTask;
import com.yanqu.road.server.timer.npc.NpcEventTask;
import com.yanqu.road.server.timer.oldplayerreturn.PlayerReturnBindRewardSendTask;
import com.yanqu.road.server.timer.oldplayerreturn.PlayerReturnTask;
import com.yanqu.road.server.timer.orewar.OreWarSyncPatronsTask;
import com.yanqu.road.server.timer.orewar.OreWarTask;
import com.yanqu.road.server.timer.palace.PalaceTask;
import com.yanqu.road.server.timer.player.*;
import com.yanqu.road.server.timer.push.LogAnalysisPushTask;
import com.yanqu.road.server.timer.push.OnlineNumTask;
import com.yanqu.road.server.timer.push.PushDataTask;
import com.yanqu.road.server.timer.sacrifice.SacrificeCheckTask;
import com.yanqu.road.server.timer.seacraftsouthsea.SeacraftSouthSeaTask;
import com.yanqu.road.server.timer.share.CheckShareCodeTask;
import com.yanqu.road.server.timer.shushan.ShuShanTask;
import com.yanqu.road.server.timer.splitflow.UploadRegisterNumToRedisTask;
import com.yanqu.road.server.timer.springdinner.SpringDinnerTask;
import com.yanqu.road.server.timer.statistics.StatisticsTask;
import com.yanqu.road.server.timer.stronghold.StrongholdTradeTimeTask;
import com.yanqu.road.server.timer.stronghold.StrongholdUploadEliminateTask;
import com.yanqu.road.server.timer.thief.ThiefCheckTask;
import com.yanqu.road.server.timer.tradewar.ReloadTradeWarNoticeTask;
import com.yanqu.road.server.timer.tradewar.SendTrackTradeWarScoreRewardTask;
import com.yanqu.road.server.timer.translations.TranslationsRemoveOverTimeDataTask;
import com.yanqu.road.server.timer.union.*;
import com.yanqu.road.server.timer.union.cross.CrossUnionDataReqTask;
import com.yanqu.road.server.timer.vehicle.VehicleBindingTask;
import com.yanqu.road.server.timer.cross3.GameXRankTask;
import com.yanqu.road.server.timer.wingroom.SyncWingRoomEventTask;
import com.yanqu.road.server.timer.wingroom.WingRoomPatronsVisitTask;
import com.yanqu.road.server.timer.wingroom.WingRoomTask;
import com.yanqu.road.server.timer.workshop.WorkShopTask;
import com.yanqu.road.server.timer.zerotime.ZeroTimeTask;
import com.yanqu.road.server.timer.zhaoshang.ZhaoShangSyncTask;
import com.yanqu.road.server.timer.zhaoshang.ZhaoShangTask;
import com.yanqu.road.utils.executor.GeneralTask;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.time.Duration;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * 所有的定时器写在这边
 */
public class GeneralAgentTimerMgr {

    private static final Logger log = LogManager.getLogger(GeneralAgentTimerMgr.class.getName());

    private static ScheduledExecutorService timerExecutorService;

    private static List<PlayerSilverCalcTask> playerSilverCalcTaskList = new ArrayList<>();

    private static PlayerDataDailyResetTask playerDataDailyResetTask = null;

    private static PlayerDataHourResetTask playerDataHourResetTask = null;

    private static PlayerOnlineCountSaveTask playerOnlineCountSaveTask = null;

    private static PlayerHeartCheckTask playerHeartCheckTask = null;

    private static ActivityReloadTask activityReloadTask = null;

    private static ActivitySyncTask activitySyncTask = null;

    private static AutoSendActivityRewardTask autoSendActivityRewardTask = null;

    private static CheckMinePitOverTimeTask checkMinePitOverTimeTask = null;

    private static MgrDataSaveTask saveMgrTask = null;

    private static List<PlayerDataSaveTask> playerDataSaveTaskList = new ArrayList<>();
    /**
     * 商战公告每天重新加载
     */
    private static ReloadTradeWarNoticeTask reloadTradeWarNoticeTask = null;

    private static LogSaveTask logSaveTask = null;

    private static AutoLogSaveTask autoLogSaveTask = null;

    /**
     * 检测过期联姻
     */
    private static CheckApplyOverTimeTask checkApplyOverTimeTask = null;

    /**
     * 跨服亲家基本数据同步
     */
    private static RelativesUserInfoUpdateTask ralativesUserInfoUpdateTask;

    /**
     * 乔迁风云每日奖励
     */
    private static EstateWarCheckDailyRewardTask estateWarCheckDailyRewardTask = null;

    private static PlayerDecorationCheckTask playerDecorationCheckTask = null;

    private static HuntResetTask huntResetTask = null;

    private static SacrificeCheckTask sacrificeResetTask = null;

    //private static UnionDailyResetTask unionDailyResetTask = null;

    private static CrossRankActivityAllSyncTask crossRankActivityAllSyncTask = null;

    private static DisperseGoldTask disperseGoldTask = null;

    private static CrossMammonSyncTask crossMammonSyncTask = null;

    private static ChargeActivityAutoRewardTask chargeActivityAutoRewardTask = null;

    private static CrossTradeWarOpenCheckTask crossTradeWarOpenCheckTask = null;

    private static NpcEventTask npcEventTask = null;//处理npc事件逻辑

    private static SendTrackTradeWarScoreRewardTask sendTrackTradeWarScoreRewardTask = null;
    //通用后台推送数据定时任务
    private static PushDataTask pushDataTask = null;
    //在线人数定时任务
    private static OnlineNumTask onlineNumTask = null;
    //时长统计定时任务
    //private static HeartbeatTask heartbeatTask=null;
    //日志分析定时任务
    private static LogAnalysisPushTask logAnalysisPushTask = null;

    private static OreWarTask oreWarTask = null;//盐场活动定时撤回

    private static OreWarSyncPatronsTask oreWarSyncPatronsTask = null;

    private static CheckSqlConnectionTask checkSqlConnectionTask = null;

    //private static UnionTradeTask unionTradeTask = null;      //商贸路线定时检测

    private static ZhaoShangTask zhaoShangTask = null;

    private static ZhaoShangSyncTask zhaoShangSyncTask = null;

    private static CrossUnionWarOpenCheckTask crossUnionWarOpenCheckTask = null;

    private static BeautyEscortTask beautyEscortTask = null;

    private static MonopolyMarketTask monopolyMarketTask = null;

    private static MonopolyMarketJoinUnionTask monopolyMarketJoinUnionTask = null;

    private static PlayerUpdateUserInfoToCrossTask playerUpdateUserInfoToCrossTask = null;

    private static CrossDouLuoDaLuTask crossDouLuoDaLuTask = null;

    private static CrossUnionDataReqTask crossUnionDataReqTask = null;

    private static UploadUnionRewardTask uploadUnionRewardTask = null;

    private static UserOnlineTimeTask userOnlineTimeTask = null;

    /**
     * 每日零点执行
     */
    private static ZeroTimeTask zeroTimeTask = null;

    /**
     * 上报redis注册人数
     *
     * @return
     */
    private static UploadRegisterNumToRedisTask uploadRegisterNumToRedisTask = null;

    /**
     * 定时上传淘汰赛联盟数据
     */
    private static StrongholdUploadEliminateTask strongholdUploadEliminateTask = null;
    private static StrongholdTradeTimeTask strongholdTradeTimeTask = null;
    //private static UnionFlagTask unionFlagTask = null;

    private static GetFbFollowCountTask getFbFollowCountTask = null;

    private static BulletScreenTask bulletScreenTask = null;

    private static DFWUnionAdditionTask dfwUnionAdditionTask = null;
    private static UnionWarActivityTask unionWarActivityTask = null; //商会战定时请求新增冠军商会
    private static UploadGroupRankTask uploadGroupRankTask = null;
    private static DirectMemoryMonitorTask directMemoryMonitorTask;

    private static CheckDeadLockTask checkDeadLockTask;

    // 统计
    private static StatisticsTask statisticsTask = null;

    private static BusyFarmingTask busyFarmingTask;

    private static ClientPushMsgTask clientPushMsgTask = null;
    private static TranslationsRemoveOverTimeDataTask translationsRemoveOverTimeDataTask = null;

    // 小偷系统检查小偷生成
    private static ThiefCheckTask thiefCheckTask = null;

    private static UploadActivityRankTask uploadActivityRankTask;
    private static CheckManorHelpRecoverTask checkManorHelpRecoverTask;
    private static VehicleBindingTask vehicleBindingTask;

    private static CookBoyTimerTask cookBoyTimerTask = null;
    private static NewAutoSendActivityRewardTask newAutoSendActivityRewardTask = null;

    private static ActivityEndSyncUnionMemberTask activityEndSyncUnionMemberTask = null;

    private static ChefDuelTimerTask chefDuelTimerTask = null;
    private static ChefDuel2TimerTask chefDuel2TimerTask = null;
    private static ChefDuelPhase1ReloadCrossTimerTask reloadCrossChefDuel1TimerTask = null;

    private static DataAnalyticsTask dataAnalyticsTask = null;
    private static ManorWeatherChangeTask manorWeatherChangeTask = null;
    private static ShareActivitySyncTask shareActivitySyncTask;
    private static CheckShareCodeTask checkShareCodeTask;
    private static ActivityItemRecycleTask activityItemRecycleTask = null;


    //同步在线的玩家且在界面的小人生成情况
    private static DouLuoShrekSyncNpcTask douluoShrekSyncNpcTimer = null;
    //换皮史莱克 阳泉酒家定时器 同步在线的玩家且在界面的小人生成情况
    private static YqHotelSyncNpcTask yqHotelSyncNpcTimer = null;

    private static PlayerReturnTask playerReturnTask;
    private static PlayerReturnBindRewardSendTask playerReturnBindRewardSendTask;

    private static GameXRankTask gameXRankTask = null;

    private static ActivityAbleCheckTask activityAbleCheckTask = null;

    private static GameXRankAllSyncTask gameXRankAllSyncTask = null;

    private static GameXUserBaseInfoClearTask gameXUserBaseInfoClearTask = null;

    private static SpringDinnerTask springDinnerDebugTask;

    private static TaoBaoResetTask taoBaoResetTask;

    private static SeacraftSouthSeaTask seacraftSouthSeaTask = null;

    private static TonBingTask tonBingTask = null;

    private static PalaceTask palaceTask = null;

    private static UnionActivityTaskTask unionActivityTaskTask = null;

    private static WorkShopTask workShopTask;

    private static WingRoomTask wingRoomTask;

    private static WingRoomPatronsVisitTask wingRoomPatronsVisitTask;

    private static SyncWingRoomEventTask syncWingRoomEventTask;

    private static CheckBeVisitNumRecoverTask checkBeVisitNumRecoverTask;

    /**
     * 活动结束了，有对局或者其他什么的要结算通过这个定时器去触发
     */
    private static ActivityOverSendGameRewardTask activityOverSendGameRewardTask;

    private static ShuShanTask shuShanTask = null;

    private static TongBingUploadAbilityTask tongBingUploadAbilityTask = null;

    private static SuiTangUploadAbilityTask suiTangUploadAbilityTask = null;

    private static OperaMaskEndSceneTask operaMaskEndSceneTask = null;

    private static RankUnionWarTimerTask rankUnionWarTimerTask = null;

    private static SyncPendingMapTimerTask syncPendingMapTimerTask = null;

    private static TwinsTimerTask twinsTimerTask = null;

    private static WasheTask washeTask = null;
    private static WasheAutoSendZhanLingTask washeAutoSendZhanLingTask = null;

    private static CricketGameTaskTimer cricketGameTaskTimer = null;

    //巅峰据点战同步数据用定时器
    private static PeakStrongholdTakeDataTask peakStrongholdTakeDataTask = null;

    private static LionDanceTask danceTask = null;

    private static LangYaMemorialTask memorialTask = null;

    private static NewYearBagLoginRewardTask newYearBagLoginRewardTask = null;

    private static XiuXianSyncCampEnergyTask xiuxianSyncCampEnergyTask = null;      // 定时间隔30s

    private static CrossUnionMemberAbilityCheckTask memberMaxAbilityCheckTask = null;
    private static CrossUnionMemberAbilitySyncTask memberMaxAbilitySyncTask = null;

    private static CheckUnionRankMsgOverTask unionRankMsgOverTask = null;

    private static PeakSeacraftRoundCheckTask peakSeacraftRoundCheckTask = null;

    private static RecallPlayerBindTaskSyncTask recallPlayerBindTaskSyncTask = null;

    private static FiveHeroTask fiveHeroTask = null;

    private static MessageSubscribeTask messageSubscribeTask = null;

    private static EnterNameActivityTask enterNameActivityTask = null;

    private static DestroyRoleCheckTask destroyRoleCheckTask = null;

    private static AdvertisementCheckResetTask advertisementCheckResetTask = null;

    private static UnionCampWarTask unionCampWarTask = null;

    private static KuangUploadAttributeTask kuangUploadAttributeTask = null;

    private static CrossBanquetAutoOpenTask banquetAutoOpenTask = null;

    private static NewMonopolyMarketTask newMonopolyMarketTask = null;

    private static PlatformDataCheckTask platformDataCheckTask = null;

    private static PatronsUploadAbilityTask patronsUploadAbilityTask = null;

    private static JiuZhouActivityGetWinnerTask jiuZhouActivityGetWinnerTask = null;

    private static ActivityMallDayBuyTask activityMallDayBuyTask = null;

    private static CurioTask curioTask = null;

    private static MeiTuanDaiJinQuanNoticeTask meiTuanDaiJinQuanNoticeTask = null;

    private static SceneCardTask sceneCardTask = null;

    private static SummerQuizTask summerQuizTask = null;

    private static PlayerOnlineCalTask playerOnlineCalTask = null;

    private static HorseRunUpdateConditionTask horseRunUpdateConditionTask = null;

    private static IceServerGiftSendRewardTask iceServerGiftSendRewardTask = null;

    public static synchronized boolean initGlobalTimers() {
        timerExecutorService = TempServer.getTimerExecutorService();
        int interval;
        // 检查玩家心跳
        interval = 5;
        if (null == playerHeartCheckTask) {
            playerHeartCheckTask = new PlayerHeartCheckTask();
            timerExecutorService.scheduleWithFixedDelay(playerHeartCheckTask, interval, interval, TimeUnit.SECONDS);
        }

        interval = getNextResetTaskExecuteTime();        //一天重置
        if (playerDataDailyResetTask == null) {
            playerDataDailyResetTask = new PlayerDataDailyResetTask();
            timerExecutorService.scheduleWithFixedDelay(playerDataDailyResetTask, interval + 2, 60 * 60 * 24, TimeUnit.SECONDS);
        }

        if (playerDataHourResetTask == null) {
            playerDataHourResetTask = new PlayerDataHourResetTask();
            timerExecutorService.scheduleWithFixedDelay(playerDataHourResetTask, 5, 1, TimeUnit.SECONDS);
        }

        if (getFbFollowCountTask == null) {
            getFbFollowCountTask = new GetFbFollowCountTask();
            timerExecutorService.scheduleWithFixedDelay(getFbFollowCountTask, 5, 60, TimeUnit.SECONDS);
        }

        interval = 1;
        if (null == activityReloadTask) {
            activityReloadTask = new ActivityReloadTask();
            timerExecutorService.scheduleWithFixedDelay(activityReloadTask, interval + 2, interval, TimeUnit.SECONDS);
        }

        if (null == activitySyncTask){
            activitySyncTask = new ActivitySyncTask();
            timerExecutorService.scheduleWithFixedDelay(activitySyncTask, interval + 2, 60, TimeUnit.SECONDS);
        }

        interval = 3;
        int calcUserDataThreadCount = Runtime.getRuntime().availableProcessors();
        for (int index = 0; index < calcUserDataThreadCount; index++) {
            PlayerSilverCalcTask playerSilverCalcTask = new PlayerSilverCalcTask(index);
            timerExecutorService.scheduleWithFixedDelay(playerSilverCalcTask, interval, interval, TimeUnit.SECONDS);
            playerSilverCalcTaskList.add(playerSilverCalcTask);
        }

        interval = 60;
        if (null == playerOnlineCountSaveTask) {
            playerOnlineCountSaveTask = new PlayerOnlineCountSaveTask();
            timerExecutorService.scheduleWithFixedDelay(playerOnlineCountSaveTask, interval, interval, TimeUnit.SECONDS);
        }

        interval = 5;
        if (checkSqlConnectionTask == null) {
            checkSqlConnectionTask = new CheckSqlConnectionTask();
            timerExecutorService.scheduleWithFixedDelay(checkSqlConnectionTask, interval, interval, TimeUnit.SECONDS);
        }

        interval = 3;
        int saveMgrThreadCount = Runtime.getRuntime().availableProcessors();
        if (null == saveMgrTask) {
            for (int index = 0; index < saveMgrThreadCount; index++) {
                saveMgrTask = new MgrDataSaveTask(index);
                timerExecutorService.scheduleWithFixedDelay(saveMgrTask, 0, interval, TimeUnit.SECONDS);
            }
        }

        if (null == pushDataTask) {
            pushDataTask = new PushDataTask();
            timerExecutorService.scheduleWithFixedDelay(pushDataTask, 0, 5, TimeUnit.SECONDS);
        }

        if (null == onlineNumTask) {
            onlineNumTask = new OnlineNumTask();
            timerExecutorService.scheduleWithFixedDelay(onlineNumTask, 0, 5, TimeUnit.MINUTES);
        }
       /* if (null == heartbeatTask) {
            heartbeatTask = new HeartbeatTask();
            timerExecutorService.scheduleWithFixedDelay(heartbeatTask, 0, 5, TimeUnit.MINUTES);
        }*/
        for (int i = 0; i < 2; i++) {
            if (null == logAnalysisPushTask) {
                logAnalysisPushTask = new LogAnalysisPushTask();
                timerExecutorService.scheduleWithFixedDelay(logAnalysisPushTask, 1, 1, TimeUnit.SECONDS);
            }
        }
        interval = 3;
        int saveUserDataThreadCount = Runtime.getRuntime().availableProcessors();
        for (int saveIndex = 0; saveIndex < saveUserDataThreadCount; saveIndex++) {
            PlayerDataSaveTask userDataTask = new PlayerDataSaveTask(saveIndex);
            timerExecutorService.scheduleWithFixedDelay(userDataTask, 0, interval, TimeUnit.SECONDS);
            playerDataSaveTaskList.add(userDataTask);
        }

        interval = 60;
        if (null == logSaveTask) {
            logSaveTask = new LogSaveTask();
            timerExecutorService.scheduleWithFixedDelay(logSaveTask, interval, interval, TimeUnit.SECONDS);
        }

        if (null == autoLogSaveTask) {
            autoLogSaveTask = new AutoLogSaveTask();
            timerExecutorService.scheduleWithFixedDelay(autoLogSaveTask, 60, 60, TimeUnit.SECONDS);
        }

        if (null == reloadTradeWarNoticeTask) {
            interval = getNextResetTaskExecuteTime();
            reloadTradeWarNoticeTask = new ReloadTradeWarNoticeTask();
            timerExecutorService.scheduleWithFixedDelay(reloadTradeWarNoticeTask, interval + 2, 60 * 60 * 24, TimeUnit.SECONDS);
        }

        if (null == checkApplyOverTimeTask) {
            checkApplyOverTimeTask = new CheckApplyOverTimeTask();
            timerExecutorService.scheduleWithFixedDelay(checkApplyOverTimeTask, 5, 5, TimeUnit.SECONDS);
        }

        if (null == ralativesUserInfoUpdateTask){
            ralativesUserInfoUpdateTask = new RelativesUserInfoUpdateTask();
            timerExecutorService.scheduleWithFixedDelay(ralativesUserInfoUpdateTask, 15, 10, TimeUnit.SECONDS);
        }

        if (null == autoSendActivityRewardTask) {
            autoSendActivityRewardTask = new AutoSendActivityRewardTask();
            timerExecutorService.scheduleWithFixedDelay(autoSendActivityRewardTask, 5, 5, TimeUnit.SECONDS);
        }

        if (null == checkMinePitOverTimeTask) {
            checkMinePitOverTimeTask = new CheckMinePitOverTimeTask();
            timerExecutorService.scheduleWithFixedDelay(checkMinePitOverTimeTask, 5, 5, TimeUnit.SECONDS);
        }

        if (null == estateWarCheckDailyRewardTask) {
            estateWarCheckDailyRewardTask = new EstateWarCheckDailyRewardTask();
            timerExecutorService.scheduleWithFixedDelay(estateWarCheckDailyRewardTask, 5, 1, TimeUnit.SECONDS);
        }

        if (null == playerDecorationCheckTask) {
            playerDecorationCheckTask = new PlayerDecorationCheckTask();
            timerExecutorService.scheduleWithFixedDelay(playerDecorationCheckTask, 5, 5, TimeUnit.SECONDS);
        }

        if (null == huntResetTask) {
            huntResetTask = new HuntResetTask();
            timerExecutorService.scheduleWithFixedDelay(huntResetTask, 5, 3, TimeUnit.SECONDS);
        }

        if (null == sacrificeResetTask) {
            sacrificeResetTask = new SacrificeCheckTask();
            timerExecutorService.scheduleWithFixedDelay(sacrificeResetTask, 5, 3, TimeUnit.SECONDS);
        }

//        if (null == unionDailyResetTask) {
//            unionDailyResetTask = new UnionDailyResetTask();
//            timerExecutorService.scheduleWithFixedDelay(unionDailyResetTask, 5, 1, TimeUnit.SECONDS);
//        }

        if (null == crossRankActivityAllSyncTask) {
            crossRankActivityAllSyncTask = new CrossRankActivityAllSyncTask();
            timerExecutorService.scheduleWithFixedDelay(crossRankActivityAllSyncTask, 30, 5, TimeUnit.SECONDS);
        }
        if (null == disperseGoldTask) {
            disperseGoldTask = new DisperseGoldTask();
            timerExecutorService.scheduleWithFixedDelay(disperseGoldTask, 5, 10, TimeUnit.SECONDS);
        }

        if (null == crossMammonSyncTask) {
            crossMammonSyncTask = new CrossMammonSyncTask();
            timerExecutorService.scheduleWithFixedDelay(crossMammonSyncTask, 5, 10, TimeUnit.SECONDS);
        }

        if (chargeActivityAutoRewardTask == null) {
            chargeActivityAutoRewardTask = new ChargeActivityAutoRewardTask();
            timerExecutorService.scheduleWithFixedDelay(chargeActivityAutoRewardTask, 5, 1, TimeUnit.SECONDS);
        }

        if (null == crossTradeWarOpenCheckTask) {
            crossTradeWarOpenCheckTask = new CrossTradeWarOpenCheckTask();
            timerExecutorService.scheduleWithFixedDelay(crossTradeWarOpenCheckTask, 5, 10, TimeUnit.SECONDS);
        }

        if (null == crossUnionWarOpenCheckTask) {
            crossUnionWarOpenCheckTask = new CrossUnionWarOpenCheckTask();
            timerExecutorService.scheduleWithFixedDelay(crossUnionWarOpenCheckTask, 5, 5, TimeUnit.SECONDS);
        }

        if (null == npcEventTask) {
            npcEventTask = new NpcEventTask();
            timerExecutorService.scheduleWithFixedDelay(npcEventTask, 5, 10, TimeUnit.SECONDS);
        }

        if (sendTrackTradeWarScoreRewardTask == null) {
            sendTrackTradeWarScoreRewardTask = new SendTrackTradeWarScoreRewardTask();
            timerExecutorService.scheduleWithFixedDelay(sendTrackTradeWarScoreRewardTask, 10, 10, TimeUnit.SECONDS);
        }
        if (null == oreWarTask) {
            oreWarTask = new OreWarTask();
            timerExecutorService.scheduleWithFixedDelay(oreWarTask, 5, 10, TimeUnit.SECONDS);
        }

        if (oreWarSyncPatronsTask == null) {
            oreWarSyncPatronsTask = new OreWarSyncPatronsTask();
            timerExecutorService.scheduleWithFixedDelay(oreWarSyncPatronsTask, 5, 10, TimeUnit.SECONDS);
        }

//        if (null == unionTradeTask) {
//            unionTradeTask = new UnionTradeTask();
//            timerExecutorService.scheduleWithFixedDelay(unionTradeTask, 15, 10, TimeUnit.SECONDS);
//        }

        if (null == zhaoShangTask) {
            zhaoShangTask = new ZhaoShangTask();
            timerExecutorService.scheduleWithFixedDelay(zhaoShangTask, 15, 10, TimeUnit.SECONDS);
        }

        if (null == zhaoShangSyncTask){
            zhaoShangSyncTask = new ZhaoShangSyncTask();
            timerExecutorService.scheduleWithFixedDelay(zhaoShangSyncTask, 15, 5, TimeUnit.SECONDS);
        }

        if (null == zeroTimeTask) {
            zeroTimeTask = new ZeroTimeTask();
            timerExecutorService.scheduleWithFixedDelay(zeroTimeTask, 15, 15, TimeUnit.SECONDS);
        }

        if (uploadRegisterNumToRedisTask == null) {
            uploadRegisterNumToRedisTask = new UploadRegisterNumToRedisTask();
            timerExecutorService.scheduleWithFixedDelay(uploadRegisterNumToRedisTask, 0, 120, TimeUnit.SECONDS);
        }

        if (strongholdUploadEliminateTask == null) {
            strongholdUploadEliminateTask = new StrongholdUploadEliminateTask();
            timerExecutorService.scheduleWithFixedDelay(strongholdUploadEliminateTask, 0, 10, TimeUnit.SECONDS);
        }
        if (strongholdTradeTimeTask == null) {
            strongholdTradeTimeTask = new StrongholdTradeTimeTask();
            timerExecutorService.scheduleWithFixedDelay(strongholdTradeTimeTask, 0, 3, TimeUnit.SECONDS);
        }
//        if (unionFlagTask == null) {
//            unionFlagTask = new UnionFlagTask();
//            timerExecutorService.scheduleWithFixedDelay(unionFlagTask, 0, 10, TimeUnit.SECONDS);
//        }

        if (dfwUnionAdditionTask == null) {
            dfwUnionAdditionTask = new DFWUnionAdditionTask();
            timerExecutorService.scheduleWithFixedDelay(dfwUnionAdditionTask, 10, 3, TimeUnit.SECONDS);
        }

        if (unionWarActivityTask == null) {
            unionWarActivityTask = new UnionWarActivityTask();
            timerExecutorService.scheduleWithFixedDelay(unionWarActivityTask, 15, 15, TimeUnit.SECONDS);
        }

        if (bulletScreenTask == null){
            bulletScreenTask = new BulletScreenTask();
            timerExecutorService.scheduleWithFixedDelay(bulletScreenTask, 10, 5, TimeUnit.SECONDS);
        }
        if (uploadGroupRankTask == null) {
            uploadGroupRankTask = new UploadGroupRankTask();
            timerExecutorService.scheduleWithFixedDelay(uploadGroupRankTask, 5, 2, TimeUnit.SECONDS);
        }
        if (directMemoryMonitorTask == null) {
            directMemoryMonitorTask = new DirectMemoryMonitorTask();
            timerExecutorService.scheduleWithFixedDelay(directMemoryMonitorTask, 60, 60, TimeUnit.SECONDS);
        }
        if (checkDeadLockTask == null) {
            checkDeadLockTask = new CheckDeadLockTask();
            timerExecutorService.scheduleWithFixedDelay(checkDeadLockTask, 0, 30, TimeUnit.SECONDS);
        }
        if (statisticsTask == null) {
            statisticsTask = new StatisticsTask();
            timerExecutorService.scheduleWithFixedDelay(statisticsTask, 15, 10 * 60, TimeUnit.SECONDS);
        }

        if (busyFarmingTask == null){
            busyFarmingTask = new BusyFarmingTask();
            timerExecutorService.scheduleWithFixedDelay(busyFarmingTask, 10, 20, TimeUnit.SECONDS);
        }

        if (clientPushMsgTask == null) {
            clientPushMsgTask = new ClientPushMsgTask();
            timerExecutorService.scheduleWithFixedDelay(clientPushMsgTask, 0, 10, TimeUnit.SECONDS);
        }

        if (beautyEscortTask == null){
            beautyEscortTask = new BeautyEscortTask();
            timerExecutorService.scheduleWithFixedDelay(beautyEscortTask, 10, 10, TimeUnit.SECONDS);
        }

        if (crossDouLuoDaLuTask == null){
            crossDouLuoDaLuTask = new CrossDouLuoDaLuTask();
            timerExecutorService.scheduleWithFixedDelay(crossDouLuoDaLuTask, 20, 15, TimeUnit.SECONDS);
        }

        if (crossUnionDataReqTask == null){
            crossUnionDataReqTask = new CrossUnionDataReqTask();
            timerExecutorService.scheduleWithFixedDelay(crossUnionDataReqTask, 10, 65, TimeUnit.SECONDS);
        }

        if (uploadUnionRewardTask == null){
            uploadUnionRewardTask = new UploadUnionRewardTask();
            timerExecutorService.scheduleWithFixedDelay(uploadUnionRewardTask, 60, 60, TimeUnit.SECONDS);
        }

        if (translationsRemoveOverTimeDataTask == null) {
            translationsRemoveOverTimeDataTask = new TranslationsRemoveOverTimeDataTask();
            timerExecutorService.scheduleWithFixedDelay(translationsRemoveOverTimeDataTask, 0, 1, TimeUnit.HOURS);
        }

        if (thiefCheckTask == null) {
            thiefCheckTask = new ThiefCheckTask();
            timerExecutorService.scheduleWithFixedDelay(thiefCheckTask, 10, 60, TimeUnit.SECONDS);
        }
        if (uploadActivityRankTask == null) {
            uploadActivityRankTask = new UploadActivityRankTask();
            timerExecutorService.scheduleWithFixedDelay(uploadActivityRankTask, 1, 1, TimeUnit.SECONDS);
        }
        if (checkManorHelpRecoverTask == null) {
            checkManorHelpRecoverTask = new CheckManorHelpRecoverTask();
            timerExecutorService.scheduleWithFixedDelay(checkManorHelpRecoverTask, 10, 5, TimeUnit.SECONDS);
        }

        if (cookBoyTimerTask == null) {
            cookBoyTimerTask = new CookBoyTimerTask();
            timerExecutorService.scheduleWithFixedDelay(cookBoyTimerTask, 10, 10, TimeUnit.SECONDS);
        }

        if (chefDuelTimerTask == null) {
            chefDuelTimerTask = new ChefDuelTimerTask();
            timerExecutorService.scheduleWithFixedDelay(chefDuelTimerTask, 10, 10, TimeUnit.SECONDS);
        }

        if (chefDuel2TimerTask == null) {
            chefDuel2TimerTask = new ChefDuel2TimerTask();
            timerExecutorService.scheduleWithFixedDelay(chefDuel2TimerTask, 10, 5, TimeUnit.SECONDS);
        }

        if (reloadCrossChefDuel1TimerTask == null) {
            reloadCrossChefDuel1TimerTask = new ChefDuelPhase1ReloadCrossTimerTask();
            timerExecutorService.scheduleWithFixedDelay(reloadCrossChefDuel1TimerTask, 5, 10, TimeUnit.MINUTES);
        }

        if (activityEndSyncUnionMemberTask == null) {
            activityEndSyncUnionMemberTask = new ActivityEndSyncUnionMemberTask();
            timerExecutorService.scheduleWithFixedDelay(activityEndSyncUnionMemberTask, 10, 20, TimeUnit.SECONDS);
        }

        if (vehicleBindingTask == null) {
            vehicleBindingTask = new VehicleBindingTask();
            timerExecutorService.scheduleWithFixedDelay(vehicleBindingTask, 10, 3, TimeUnit.SECONDS);
        }

        if (dataAnalyticsTask == null) {
            dataAnalyticsTask = new DataAnalyticsTask();
            timerExecutorService.scheduleWithFixedDelay(dataAnalyticsTask, 10, 5, TimeUnit.SECONDS);
        }

        if (newAutoSendActivityRewardTask == null) {
            newAutoSendActivityRewardTask = new NewAutoSendActivityRewardTask();
            timerExecutorService.scheduleWithFixedDelay(newAutoSendActivityRewardTask, 5, 1, TimeUnit.MINUTES);
        }

        if (gameXRankTask == null) {
            gameXRankTask = new GameXRankTask();
            timerExecutorService.scheduleWithFixedDelay(gameXRankTask, 10, 1, TimeUnit.SECONDS);
        }

        if (activityAbleCheckTask == null) {
            activityAbleCheckTask = new ActivityAbleCheckTask();
            timerExecutorService.scheduleWithFixedDelay(activityAbleCheckTask, 1, 1, TimeUnit.MINUTES);
        }

        if (gameXRankAllSyncTask == null) {
            gameXRankAllSyncTask = new GameXRankAllSyncTask();
            timerExecutorService.scheduleWithFixedDelay(gameXRankAllSyncTask, 30, 30, TimeUnit.SECONDS);
        }

        if (gameXUserBaseInfoClearTask == null) {
            gameXUserBaseInfoClearTask = new GameXUserBaseInfoClearTask();
            timerExecutorService.scheduleWithFixedDelay(gameXUserBaseInfoClearTask, 5, 60, TimeUnit.MINUTES);
        }

        if (monopolyMarketTask == null) {
            monopolyMarketTask = new MonopolyMarketTask();
            timerExecutorService.scheduleWithFixedDelay(monopolyMarketTask, 5, 10, TimeUnit.SECONDS);
        }

        if (monopolyMarketJoinUnionTask == null) {
            monopolyMarketJoinUnionTask = new MonopolyMarketJoinUnionTask();
            timerExecutorService.scheduleWithFixedDelay(monopolyMarketJoinUnionTask, 5, 3, TimeUnit.SECONDS);
        }

        if(playerUpdateUserInfoToCrossTask == null){
            playerUpdateUserInfoToCrossTask = new PlayerUpdateUserInfoToCrossTask();
            timerExecutorService.scheduleWithFixedDelay(playerUpdateUserInfoToCrossTask, 15, 5, TimeUnit.SECONDS);
        }

        if (manorWeatherChangeTask == null) {
            manorWeatherChangeTask = new ManorWeatherChangeTask();
            timerExecutorService.scheduleWithFixedDelay(manorWeatherChangeTask, 0, 1, TimeUnit.SECONDS);
        }


        if (shareActivitySyncTask == null) {
            shareActivitySyncTask = new ShareActivitySyncTask();
            timerExecutorService.scheduleWithFixedDelay(shareActivitySyncTask, 10, 5, TimeUnit.SECONDS);
        }

        if (checkShareCodeTask == null) {
            checkShareCodeTask = new CheckShareCodeTask();
            timerExecutorService.scheduleWithFixedDelay(checkShareCodeTask, 1, 30, TimeUnit.SECONDS);
        }
        if (springDinnerDebugTask == null) {
            springDinnerDebugTask = new SpringDinnerTask();
            timerExecutorService.scheduleWithFixedDelay(springDinnerDebugTask, 1, 1, TimeUnit.SECONDS);
        }

        if(douluoShrekSyncNpcTimer == null){
            douluoShrekSyncNpcTimer = new DouLuoShrekSyncNpcTask();
            timerExecutorService.scheduleWithFixedDelay(douluoShrekSyncNpcTimer, 15, 1, TimeUnit.SECONDS);
        }

        if (yqHotelSyncNpcTimer == null){
            yqHotelSyncNpcTimer = new YqHotelSyncNpcTask();
            timerExecutorService.scheduleWithFixedDelay(yqHotelSyncNpcTimer, 15, 1, TimeUnit.SECONDS);
        }

        if (activityItemRecycleTask == null) {
            activityItemRecycleTask = new ActivityItemRecycleTask();
            timerExecutorService.scheduleWithFixedDelay(activityItemRecycleTask, 60, 60, TimeUnit.SECONDS);
        }

        if (playerReturnTask == null) {
            playerReturnTask = new PlayerReturnTask();
            timerExecutorService.scheduleWithFixedDelay(playerReturnTask, 1, 10, TimeUnit.SECONDS);
        }

        if (playerReturnBindRewardSendTask == null) {
            playerReturnBindRewardSendTask = new PlayerReturnBindRewardSendTask();
            timerExecutorService.scheduleWithFixedDelay(playerReturnBindRewardSendTask, 1, 2, TimeUnit.MINUTES);
        }
        if (taoBaoResetTask == null) {
            taoBaoResetTask = new TaoBaoResetTask();
            timerExecutorService.scheduleWithFixedDelay(taoBaoResetTask, 1, 1, TimeUnit.SECONDS);
        }


        if (seacraftSouthSeaTask == null) {
            seacraftSouthSeaTask = new SeacraftSouthSeaTask();
            timerExecutorService.scheduleWithFixedDelay(seacraftSouthSeaTask, 10, 5, TimeUnit.SECONDS);
        }
        if (tonBingTask == null) {
            tonBingTask = new TonBingTask();
            timerExecutorService.scheduleWithFixedDelay(tonBingTask, 10, 5, TimeUnit.SECONDS);
        }

        if(null == palaceTask){
            palaceTask = new PalaceTask();
            timerExecutorService.scheduleWithFixedDelay(palaceTask, 60, 1, TimeUnit.SECONDS);
        }

        if (unionActivityTaskTask == null) {
            unionActivityTaskTask = new UnionActivityTaskTask();
            timerExecutorService.scheduleWithFixedDelay(unionActivityTaskTask, 10, 3, TimeUnit.SECONDS);
        }


        if (workShopTask == null) {
            workShopTask = new WorkShopTask();
            timerExecutorService.scheduleWithFixedDelay(workShopTask, 1, 1, TimeUnit.SECONDS);
        }

        if (wingRoomTask == null) {
            wingRoomTask = new WingRoomTask();
            timerExecutorService.scheduleWithFixedDelay(wingRoomTask, 1, 1, TimeUnit.SECONDS);
        }

        if (wingRoomPatronsVisitTask == null){
            wingRoomPatronsVisitTask = new WingRoomPatronsVisitTask();
            timerExecutorService.scheduleWithFixedDelay(wingRoomPatronsVisitTask, 10, 5, TimeUnit.SECONDS);
        }

        if (syncWingRoomEventTask == null) {
            syncWingRoomEventTask = new SyncWingRoomEventTask();
            timerExecutorService.scheduleWithFixedDelay(syncWingRoomEventTask, 10, 60, TimeUnit.SECONDS);
        }

        if (checkBeVisitNumRecoverTask == null) {
            checkBeVisitNumRecoverTask = new CheckBeVisitNumRecoverTask();
            timerExecutorService.scheduleWithFixedDelay(checkBeVisitNumRecoverTask, 10, 10, TimeUnit.SECONDS);
        }

        if(null == shuShanTask){
            shuShanTask = new ShuShanTask();
            timerExecutorService.scheduleWithFixedDelay(shuShanTask, 60, 5, TimeUnit.SECONDS);
        }

        if (tongBingUploadAbilityTask == null) {
            tongBingUploadAbilityTask = new TongBingUploadAbilityTask();
            timerExecutorService.scheduleWithFixedDelay(tongBingUploadAbilityTask, 10, 10, TimeUnit.SECONDS);
        }

        if (suiTangUploadAbilityTask == null) {
            suiTangUploadAbilityTask = new SuiTangUploadAbilityTask();
            timerExecutorService.scheduleWithFixedDelay(suiTangUploadAbilityTask, 10, 10, TimeUnit.SECONDS);
        }

        if (operaMaskEndSceneTask == null) {
            operaMaskEndSceneTask = new OperaMaskEndSceneTask();
            timerExecutorService.scheduleWithFixedDelay(operaMaskEndSceneTask, 20, 20, TimeUnit.SECONDS);
        }

        if (userOnlineTimeTask == null){
            userOnlineTimeTask = new UserOnlineTimeTask();
            timerExecutorService.scheduleWithFixedDelay(userOnlineTimeTask,0,60,TimeUnit.SECONDS);
        }
        if (rankUnionWarTimerTask == null){
            rankUnionWarTimerTask = new RankUnionWarTimerTask();
            timerExecutorService.scheduleWithFixedDelay(rankUnionWarTimerTask,1,1,TimeUnit.SECONDS);
        }
        if (syncPendingMapTimerTask == null) {
            syncPendingMapTimerTask = new SyncPendingMapTimerTask();
            timerExecutorService.scheduleWithFixedDelay(syncPendingMapTimerTask, 5, 5, TimeUnit.SECONDS);
        }

        if (twinsTimerTask == null){
            twinsTimerTask = new TwinsTimerTask();
            timerExecutorService.scheduleWithFixedDelay(twinsTimerTask,1,1,TimeUnit.SECONDS);
        }
        if (washeTask == null) {
            washeTask = new WasheTask();
            timerExecutorService.scheduleWithFixedDelay(washeTask, 10, 1, TimeUnit.SECONDS);
        }
        if (washeAutoSendZhanLingTask == null) {
            washeAutoSendZhanLingTask = new WasheAutoSendZhanLingTask();
            timerExecutorService.scheduleWithFixedDelay(washeAutoSendZhanLingTask, 60, 60, TimeUnit.SECONDS);
        }

        if (cricketGameTaskTimer == null) {
            cricketGameTaskTimer = new CricketGameTaskTimer();
            timerExecutorService.scheduleWithFixedDelay(cricketGameTaskTimer, 10, 10, TimeUnit.SECONDS);
        }

        if (peakStrongholdTakeDataTask == null) {
            peakStrongholdTakeDataTask = new PeakStrongholdTakeDataTask();
            timerExecutorService.scheduleWithFixedDelay(peakStrongholdTakeDataTask, 10, 1, TimeUnit.SECONDS);
        }
        if (danceTask == null){
            danceTask = new LionDanceTask();
            timerExecutorService.scheduleWithFixedDelay(danceTask, 10, 60, TimeUnit.SECONDS);
        }

        if (memorialTask == null){
            memorialTask = new LangYaMemorialTask();
            timerExecutorService.scheduleWithFixedDelay(memorialTask, 10, 60, TimeUnit.SECONDS);
        }

        if (newYearBagLoginRewardTask == null) {
            newYearBagLoginRewardTask = new NewYearBagLoginRewardTask();
            timerExecutorService.scheduleWithFixedDelay(newYearBagLoginRewardTask, 60, 60, TimeUnit.SECONDS);
        }

        if (xiuxianSyncCampEnergyTask == null) {
            xiuxianSyncCampEnergyTask = new XiuXianSyncCampEnergyTask();
            timerExecutorService.scheduleWithFixedDelay(xiuxianSyncCampEnergyTask, 10, 30, TimeUnit.SECONDS);
        }

        if (memberMaxAbilityCheckTask == null) {
            memberMaxAbilityCheckTask = new CrossUnionMemberAbilityCheckTask();
            timerExecutorService.scheduleWithFixedDelay(memberMaxAbilityCheckTask, 30, 120, TimeUnit.SECONDS);
        }

        if (memberMaxAbilitySyncTask == null) {
            memberMaxAbilitySyncTask = new CrossUnionMemberAbilitySyncTask();
            timerExecutorService.scheduleWithFixedDelay(memberMaxAbilitySyncTask, 30, 1, TimeUnit.SECONDS);
        }

        if (null == unionRankMsgOverTask) {
            unionRankMsgOverTask = new CheckUnionRankMsgOverTask();
            timerExecutorService.scheduleWithFixedDelay(unionRankMsgOverTask, 60, 60, TimeUnit.SECONDS);
        }

        if (null == peakSeacraftRoundCheckTask) {
            peakSeacraftRoundCheckTask = new PeakSeacraftRoundCheckTask();
            timerExecutorService.scheduleWithFixedDelay(peakSeacraftRoundCheckTask, 10, 1, TimeUnit.SECONDS);
        }

        if (null == recallPlayerBindTaskSyncTask){
            recallPlayerBindTaskSyncTask = new RecallPlayerBindTaskSyncTask();
            timerExecutorService.scheduleWithFixedDelay(recallPlayerBindTaskSyncTask,1,2,TimeUnit.MINUTES);
        }

        if (fiveHeroTask == null) {
            fiveHeroTask = new FiveHeroTask();
            timerExecutorService.scheduleWithFixedDelay(fiveHeroTask, 10, 5, TimeUnit.SECONDS);
        }

        if (messageSubscribeTask == null) {
            messageSubscribeTask = new MessageSubscribeTask();
            timerExecutorService.scheduleWithFixedDelay(messageSubscribeTask, 10, 5, TimeUnit.SECONDS);
        }
        if (null == enterNameActivityTask){
            enterNameActivityTask = new EnterNameActivityTask();
            timerExecutorService.scheduleWithFixedDelay(enterNameActivityTask,3,60, TimeUnit.SECONDS);
        }


        if (destroyRoleCheckTask == null) {
            destroyRoleCheckTask = new DestroyRoleCheckTask();
            timerExecutorService.scheduleWithFixedDelay(destroyRoleCheckTask, 120, 3, TimeUnit.SECONDS);
        }
        if (null == unionCampWarTask) {
            unionCampWarTask = new UnionCampWarTask();
            timerExecutorService.scheduleWithFixedDelay(unionCampWarTask, 10, 3, TimeUnit.SECONDS);
        }


        if (advertisementCheckResetTask == null){
            advertisementCheckResetTask = new AdvertisementCheckResetTask();
            timerExecutorService.scheduleWithFixedDelay(advertisementCheckResetTask, 5, 10, TimeUnit.SECONDS);
        }

        if (kuangUploadAttributeTask == null) {
            kuangUploadAttributeTask = new KuangUploadAttributeTask();
            timerExecutorService.scheduleWithFixedDelay(kuangUploadAttributeTask,5,10, TimeUnit.SECONDS);
        }

        if (banquetAutoOpenTask == null) {
            banquetAutoOpenTask = new CrossBanquetAutoOpenTask();
            timerExecutorService.scheduleWithFixedDelay(banquetAutoOpenTask, 120, 5, TimeUnit.SECONDS);
        }

        if (newMonopolyMarketTask == null){
            newMonopolyMarketTask = new NewMonopolyMarketTask();
            timerExecutorService.scheduleWithFixedDelay(newMonopolyMarketTask,5,30, TimeUnit.SECONDS);
        }

        if(null == platformDataCheckTask){
            platformDataCheckTask = new PlatformDataCheckTask();
            timerExecutorService.scheduleWithFixedDelay(platformDataCheckTask,60,5, TimeUnit.SECONDS);
        }

        if (patronsUploadAbilityTask == null) {
            patronsUploadAbilityTask = new PatronsUploadAbilityTask();
            timerExecutorService.scheduleWithFixedDelay(patronsUploadAbilityTask,0,1, TimeUnit.SECONDS);
        }

        if (null == jiuZhouActivityGetWinnerTask){
            jiuZhouActivityGetWinnerTask = new JiuZhouActivityGetWinnerTask();
            timerExecutorService.scheduleWithFixedDelay(jiuZhouActivityGetWinnerTask, 60, 10, TimeUnit.SECONDS);
        }


        if (activityMallDayBuyTask == null) {
            activityMallDayBuyTask = new ActivityMallDayBuyTask();
            timerExecutorService.scheduleWithFixedDelay(activityMallDayBuyTask, 10, 5, TimeUnit.SECONDS);
        }

        if (curioTask == null){
            curioTask = new CurioTask();
            timerExecutorService.scheduleWithFixedDelay(curioTask, 2, 5, TimeUnit.MINUTES);
        }

        if (meiTuanDaiJinQuanNoticeTask == null){
            meiTuanDaiJinQuanNoticeTask = new MeiTuanDaiJinQuanNoticeTask();
            timerExecutorService.scheduleWithFixedDelay(meiTuanDaiJinQuanNoticeTask, 0, 5, TimeUnit.SECONDS);
        }

        interval = 60;
        if (null == sceneCardTask) {
            sceneCardTask = new SceneCardTask();
            timerExecutorService.scheduleWithFixedDelay(sceneCardTask, interval, interval, TimeUnit.SECONDS);
        }

        if (null == summerQuizTask){
            summerQuizTask = new SummerQuizTask();
            timerExecutorService.scheduleWithFixedDelay(summerQuizTask, 1, 5, TimeUnit.MINUTES);
        }

        if (null == playerOnlineCalTask){
            playerOnlineCalTask = new PlayerOnlineCalTask();
            timerExecutorService.scheduleWithFixedDelay(playerOnlineCalTask, 30, 30, TimeUnit.SECONDS);
        }

        if (null == horseRunUpdateConditionTask){
            horseRunUpdateConditionTask = new HorseRunUpdateConditionTask();
            timerExecutorService.scheduleWithFixedDelay(horseRunUpdateConditionTask, 60, 5, TimeUnit.SECONDS);
        }

        if (null == iceServerGiftSendRewardTask){
            iceServerGiftSendRewardTask = new IceServerGiftSendRewardTask();
            timerExecutorService.scheduleWithFixedDelay(iceServerGiftSendRewardTask, 1, 1, TimeUnit.MINUTES);
        }

        return true;
    }

    private static int getNextResetTaskExecuteTime() {
        LocalDateTime currentTime = LocalDateTime.now();
        LocalDateTime nextExecute = currentTime.plusDays(1);
        nextExecute = LocalDateTime.of(nextExecute.getYear(), nextExecute.getMonth(), nextExecute.getDayOfMonth(), 0, 0,
                0, 0);
        return (int) (Duration.between(currentTime, nextExecute).getSeconds());
    }

    public static void stop() {
        cancelTask(playerHeartCheckTask);
        cancelTask(saveMgrTask);
        if (playerDataSaveTaskList != null) {
            for (PlayerDataSaveTask playerDataSaveTask : playerDataSaveTaskList) {
                cancelTask(playerDataSaveTask);
            }
        }
        cancelTask(playerDataDailyResetTask);
        cancelTask(playerOnlineCountSaveTask);
        cancelTask(activityReloadTask);
        cancelTask(autoSendActivityRewardTask);
        cancelTask(checkMinePitOverTimeTask);
        cancelTask(reloadTradeWarNoticeTask);
        cancelTask(logSaveTask);
        cancelTask(autoLogSaveTask);
        cancelTask(checkApplyOverTimeTask);
        cancelTask(estateWarCheckDailyRewardTask);
        cancelTask(playerDecorationCheckTask);
        cancelTask(huntResetTask);
        cancelTask(sacrificeResetTask);
        //cancelTask(unionDailyResetTask);
        cancelTask(crossRankActivityAllSyncTask);
        cancelTask(disperseGoldTask);
        cancelTask(crossMammonSyncTask);
        cancelTask(chargeActivityAutoRewardTask);
        cancelTask(crossTradeWarOpenCheckTask);
        cancelTask(npcEventTask);
        cancelTask(sendTrackTradeWarScoreRewardTask);
        cancelTask(oreWarTask);
        cancelTask(pushDataTask);
        //cancelTask(heartbeatTask);
        cancelTask(onlineNumTask);
        cancelTask(logAnalysisPushTask);
        //cancelTask(unionTradeTask);
        cancelTask(zeroTimeTask);
        cancelTask(uploadRegisterNumToRedisTask);
        cancelTask(strongholdTradeTimeTask);
        cancelTask(strongholdUploadEliminateTask);
        //cancelTask(unionFlagTask);
        cancelTask(dfwUnionAdditionTask);
        cancelTask(bulletScreenTask);
        cancelTask(statisticsTask);
        cancelTask(busyFarmingTask);
        cancelTask(thiefCheckTask);
        cancelTask(beautyEscortTask);
        cancelTask(crossDouLuoDaLuTask);
        cancelTask(activityEndSyncUnionMemberTask);
        cancelTask(monopolyMarketTask);
        cancelTask(monopolyMarketJoinUnionTask);
        cancelTask(playerUpdateUserInfoToCrossTask);
        cancelTask(gameXRankTask);
        cancelTask(gameXRankAllSyncTask);
        cancelTask(gameXUserBaseInfoClearTask);
        cancelTask(activityAbleCheckTask);
        cancelTask(palaceTask);
        cancelTask(workShopTask);
        cancelTask(wingRoomTask);
        cancelTask(wingRoomPatronsVisitTask);
        cancelTask(userOnlineTimeTask);
        cancelTask(washeTask);
        cancelTask(danceTask);
        cancelTask(washeAutoSendZhanLingTask);
        cancelTask(xiuxianSyncCampEnergyTask);
        cancelTask(memberMaxAbilityCheckTask);
        cancelTask(memberMaxAbilitySyncTask);
        cancelTask(unionRankMsgOverTask);
        cancelTask(peakSeacraftRoundCheckTask);
        cancelTask(enterNameActivityTask);
        cancelTask(destroyRoleCheckTask);
        cancelTask(advertisementCheckResetTask);
        cancelTask(platformDataCheckTask);
        cancelTask(curioTask);
        cancelTask(sceneCardTask);
        cancelTask(summerQuizTask);
    }

    private static void cancelTask(GeneralTask task) {
        if (null != task) {
            task.cancel(false);
        }
    }
}
